#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include <QTcpServer>
#include <QTcpSocket>
#include <QtDebug>
#include<QTimer>

QT_BEGIN_NAMESPACE
namespace Ui { class Widget; }
QT_END_NAMESPACE

class Widget : public QWidget
{
    Q_OBJECT

public:
    Widget(QWidget *parent = nullptr);
    ~Widget();
private slots:
    void on_createButton_clicked();
    void onNewConnection();
    void onReadyRead();
    void sendMessage(const QByteArray& buf);
    void onTimeOut(void);
private:
    Ui::Widget *ui;
    QTcpServer tcpServer;
    quint16 port;
    QList<QTcpSocket*> tcpClientList;
    QTimer timer;
};
#endif // WIDGET_H
